package br.com.center.loja.model;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

@NamedQueries({@NamedQuery(name="employeeByName", query="select e from Employee e where e.name like :name")})
@Entity
@Table
public class Employee extends AbstractEntity{
   
   private static final long serialVersionUID = 1L;

   @Id
   @GeneratedValue(strategy=GenerationType.IDENTITY)
   @Column
   private Long   code;
   
   @ManyToOne
   @JoinColumn(name="credential")
   private User   user;
   
   @Column(nullable=false)
   private String name;
   
   @Temporal(TemporalType.DATE)
   private Date   birthday;
   
   @Column
   private String email;
   
   public Long getCode() {
      return code;
   }
   
   public void setCode(Long code) {
      this.code = code;
   }
   
   public User getUser() {
      return user;
   }
   
   public void setUser(User user) {
      this.user = user;
   }
   
   public String getName() {
      return name;
   }
   
   public void setName(String name) {
      this.name = name;
   }
   
   public Date getBirthday() {
      return birthday;
   }
   
   public void setBirthday(Date birthday) {
      this.birthday = birthday;
   }
   
   public String getEmail() {
      return email;
   }
   
   public void setEmail(String email) {
      this.email = email;
   }
}